<?php

//覆盖ci的此函数
if ( ! function_exists('site_url'))
{
	function site_url($uri = '', $param = array())
	{
		$ci = &get_instance();
		return $ci->config->site_url($uri).($param ? (is_array($param) ? ('?'.http_build_query($param)) : ('?'.ltrim($param, '?'))) : '');
	}
}

//管理后台专用
if ( ! function_exists('admin_url'))
{
	function admin_url($uri = '', $param = array())
	{
		return site_url('admin/'.ltrim($uri, '/'), $param);
	}
}

//主题url
if ( ! function_exists('theme_url'))
{
	function theme_url($uri)
	{
		$ci = & get_instance();
		return base_url('/themes/'.$ci->template->theme()).'/'.ltrim($uri, '/');
	}
}

//公共资源url
if ( ! function_exists('asset_url'))
{
	function asset_url($uri)
	{
		$ci = & get_instance();
		return base_url('/assets').'/'.ltrim($uri, '/');
	}
}